﻿using SQLite;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace TangReadyV1.Models
{
   public class FlowTable
    {
        [PrimaryKey, AutoIncrement]
        public int ID { get; set; }
        public string SellDate { get; set; }
        public DateTime Sell2Date { get; set; }
        public int MaxID { get; set; }
    }
    public class SaleTable
    {
        [PrimaryKey, AutoIncrement]
        public int ID { get; set; }

        public string SKTNO { get; set; } //收款台号
        public string JYSJ { get; set; }  //交易时间+时分秒
        public DateTime JYSJ2 { get; set; }  //交易时间+时分秒
        public string JZRQ { get; set; } //记账日期短
        public decimal XSJE { get; set; }  //销售总金额 ？？该次

        public string JYLX { get; set; }    //交易类型  销售 或退款

        public string JYBH { get; set; }    //交易单号  销售日期8+ 流水4


        public int TCKT_INX { get; set; } //分单号
        public string INX { get; set; }    //序号
        public string SPCODE { get; set; }
        public decimal LSDJ { get; set; }   // 6 定价  价格 单价可能为负值，退款
        public int XSSL { get; set; }     //销售数量     
        public decimal ZKJE { get; set; } //折扣金额
        public string YHJE { get; set; }  //优惠金额
        public string SCF { get; set; }  //长传服
                                         //   public int SKFS { get; set; }  //收款方式代码 
        public string SKFS { get; set; }  //收款方式代码 +Name
        public string SKJE { get; set; }  //收款金额????

        public string Uploaded { get; set; }
        public string ResultMsg { get; set; }




    }

    public class SaleTableFinished
    {
        [PrimaryKey, AutoIncrement]
        public int ID { get; set; }

        public string SKTNO { get; set; } //收款台号
        public string JYSJ { get; set; }  //交易时间+时分秒
        public DateTime JYSJ2 { get; set; }  //交易时间+时分秒
        public string JZRQ { get; set; } //记账日期短
        public decimal XSJE { get; set; }  //销售总金额 ？？该次

        public string JYLX { get; set; }    //交易类型  销售 或退款

        public string JYBH { get; set; }    //交易单号  销售日期8+ 流水4


        //  public string TCKT_INX { get; set; } //分单号
        public int TCKT_INX { get; set; } //分单号
        public int INX { get; set; }    //序号
        public string SPCODE { get; set; }
        public decimal LSDJ { get; set; }   // 6 定价  价格 单价可能为负值，退款
        public int XSSL { get; set; }     //销售数量     
        public decimal ZKJE { get; set; } //折扣金额
        public string YHJE { get; set; }  //优惠金额
        public string SCF { get; set; }  //长传服
                                         //   public int SKFS { get; set; }

        //收款方式代码 

        public string SKFS { get; set; }  //收款方式代码 +Name
        public string SKJE { get; set; }  //收款金额????

        public string Uploaded { get; set; }

        // [MaxLength=250]
        public string ResultMsg { get; set; }




    }
    public class SKFSZ
    {
        public int CODE { get; set; }
        public string NAME { get; set; }
        public bool CODESpecified { get; set; }
        public bool IsChecked { get; set; }

        public override string ToString()
        {
            return CODE.ToString() + "(" + NAME + ")";
        }
    }

    public class CommonFS
    {
        [PrimaryKey, AutoIncrement]
        public int ID { get; set; }
        public int CODE { get; set; }
        public string NAME { get; set; }
        public bool IsChecked { get; set; }

    }

    public class SKFSZRepository
    {
        private ObservableCollection<SKFSZ> orderInfo;
        public ObservableCollection<SKFSZ> OrderInfoCollection
        {
            get; set;
        }
        static private SKFSZRepository _instance = new SKFSZRepository();
        static public SKFSZRepository Instance
        {
            get
            {
                return _instance;
            }
        }


        private SKFSZRepository()
        {
            orderInfo = new ObservableCollection<SKFSZ>();
            //  this.GenerateOrders();
        }

        private void GenerateOrders()
        {
            orderInfo.Add(new SKFSZ() { CODE = 001, NAME = "Ran01", CODESpecified = true, IsChecked = true });
            orderInfo.Add(new SKFSZ() { CODE = 002, NAME = "Ran02", CODESpecified = true, IsChecked = true });
            orderInfo.Add(new SKFSZ() { CODE = 003, NAME = "Ran03", CODESpecified = true, IsChecked = false });
            orderInfo.Add(new SKFSZ() { CODE = 004, NAME = "Ran04", CODESpecified = true, IsChecked = false });
            orderInfo.Add(new SKFSZ() { CODE = 005, NAME = "Ran05", CODESpecified = true, IsChecked = true });

        }
    }
    public class XSJLC
    {
        public string SKTNO { get; set; }
        public int TCKT_INX { get; set; }
        public string INX { get; set; }
        public string SPCODE { get; set; }
        public decimal LSDJ { get; set; }   // 6 定价  价格
        public int XSSL { get; set; }     //销售数量
        public decimal XSJE { get; set; }
        public decimal ZKJE { get; set; } //折扣金额
        public string YHJE { get; set; }
    }

    public class XSJLM
    {
        public string SKTNO { get; set; }
        public string SKFS { get; set; }  //支付方式
        public string SKJE { get; set; }  //支付方式金额
    }

    public class XSJL
    {
        public string SKTNO { get; set; }
        public string JYSJ { get; set; }
        public string JZRQ { get; set; }
        public decimal XSJE { get; set; }  //销售金额
        public List<XSJLC> XSJLC { get; set; }
        public List<XSJLM> XSJLM { get; set; }
    }


}
